home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
FileDropper2.0ァ1 Folder.sit
/
FileDropper2.0゚1 Folder
/
FD Starter
/
Starter Main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-04
|
5KB
|
138 lines
#include "FD Interface.h"
/*****
* This is the module's main entrypoint.
*****/
Boolean ModuleMain( short message, ModuleDataRec *moduleData)
{
Boolean returnValue = TRUE;
switch (message)
{
case eStartup :
// The application just started. Set up any custom
// stuff you want.
SetStatusParams( TRUE, TRUE, "¥pMoof!");
returnValue = TRUE; // TRUE means everything is OK. If you return FALSE here,
// you will receive an eQuitting message and File Dropper
// will quit. You will NOT get an eDispose message.
break;
case eSFInitialize :
/*
* The SFGetFile is about to be brought up - you can install your own at this point
* if you want to.
* If the user chooses a file, you will receive one each of eValidate and eProcessFile
* messages. If s/he chooses a folder, you will receive an eValidate and eProcessFile
* message for each file in the folder, and each file in each folder on down the line.
* NOTE: you only get one of these for each time the SFGetFile dialog comes up. If
* you want to initialize something before each file, do it in the eProcessFile case.
*/
returnValue = TRUE; // TRUE means everything is OK. If you return FALSE here,
// you will receive an eQuitting message and File Dropper
// will quit. You will NOT get an eDispose message.
break;
case eAEInitialize :
// An 'odoc' AppleEvent has been received - you are about to be flooded with
// eValidateFile and eProcessFile messages (a set for each file you need to process)
// NOTE, you only get one eAEInitialize for the whole batch of files. If you want to
// initialize something before each file, do it in the eProcessFile case.
returnValue = TRUE; // TRUE means everything is OK. If you return FALSE here,
// you will receive an eQuitting message and File Dropper
// will quit. You will NOT get an eDispose message.
break;
case eValidateFile :
SetStatusParams( TRUE, TRUE, NULL);
// validate the file here
returnValue = TRUE; // TRUE means theFile in moduleData is one that
// you want to process
break;
case eProcessFile :
// Do your stuff - theFile in moduleData is the file
// you need to process
// Here, I simply am showing off the progress bar stuff.
{
short i;
ChangeStatusMessage( moduleData->theFile->name);
for ( i=0; i <= 50; i++) SetStatusPercentage( i);
ChangeStatusMessage( "¥pProcessing phase 2");
for ( ; i >= 25; i--) SetStatusPercentage( i);
ChangeStatusMessage( "¥pFinishing up");
for ( ; i <= 100; i++) SetStatusPercentage( i);
}
returnValue = TRUE; // return TRUE to continue processing any remaining files,
// or FALSE to stop prematurely
break;
case eUserCancelled :
// The user clicked Cancel in the satatus dialog. Since File
// Dropper handles the status dialog whenever you call
// SetStatusPercentage, you will get this message only during
// a call to SetStatusPercentage.
// moduleData->theFile is the file that was being processed
// when the user clicked Cancel.
returnValue = TRUE; // Return TRUE to receive an eDispose, an eQuitting message, and
// have File Dropper ExitToShell.
// Return FALSE to pretend the Cancel didn't get clicked, although
// you could keep track and immediately return FALSE from the
// eProcessFile case.
break;
case eDispose :
// If you allocated any storage in eSFInitialize or
// eAEInitialize, dispose of it here.
returnValue = FALSE; // return FALSE if you want File Dropper to send you an
// eQuitting message and quit.
// TRUE means you want to keep running
break;
case eDoAboutBox :
// Give yourself some credit.
// If you return TRUE from this message, I will handle the
// about box by reading from the STR# number 129. I will
// read all strings starting with number 1 in that resource
// and display them in the about box. Only up to about 6
// strings will actually fit in the about box.
// If you return FALSE from the eDoAboutBox message, I will
// assume that you handled the about box and do nothing.
break;
case eQuitting :
// The application is about to quit, save anything
// that needs to be saved.
// returnValue is ignored for this message
break;
case eIdle :
// You can do whatever you want, including nothing, here.
// It's continuously called when there are no files to process
// and File Dropper is receiving NULL events.
// returnValue is ignored for this message
break;
}
return returnValue;
}